Skip to content
This repository has been archived by the owner on Dec 7, 2021. It is now read-only.

Don't add Hadamards to a user-defined initial state in QAOA #1362

Merged
merged 10 commits into from
Oct 23, 2020

Conversation

Milos9304
Copy link
Contributor

@Milos9304 Milos9304 commented Oct 16, 2020

Summary

initial_state provided to QAOA gets composed with Hadamard gates, which is an undesired behaviour. I assume this bug is a result of implementation of the case where no initial_state is set. In this default case the input state to ansatz circuit is |+++...++> as described in QAOA Farhi's paper, hence the Hadamards.

Details and comments

My solution is straightforward and can be easily seen from code. I am working on fixing the tests.

@CLAassistant
Copy link

CLAassistant commented Oct 16, 2020

CLA assistant check
All committers have signed the CLA.

@Milos9304 Milos9304 changed the title QAOA initial_state problem [WIP] QAOA initial_state problem Oct 16, 2020
@Milos9304 Milos9304 changed the title [WIP] QAOA initial_state problem QAOA initial_state problem Oct 18, 2020
@Cryoris
Copy link
Contributor

Cryoris commented Oct 19, 2020

Hi @Milos9304, thanks for the contribution! Could you also add a release note saying that you fixed this? 🙂 (And a test of course, but you already mentioned you're working on that)

@Cryoris Cryoris changed the title QAOA initial_state problem Don't add Hadamards to a user-defined initial state in QAOA Oct 19, 2020
@Cryoris Cryoris added the Changelog: Bugfix Include in the Fixed section of the changelog label Oct 19, 2020
@Milos9304
Copy link
Contributor Author

Hi @Milos9304, thanks for the contribution! Could you also add a release note saying that you fixed this? (And a test of course, but you already mentioned you're working on that)

Done. I am quite confused with some of the unrelated tests failing for weird errors like e.g. ECONNRESET etc. My test in optimization seems to be working fine.

P.S. This is my very first open-source contribution so I apologize if I am doing some mess around here.

@woodsp-ibm
Copy link
Member

woodsp-ibm commented Oct 22, 2020

The build system caches the downloaded packages in order to save time on subsequent builds. It seems there was a problem saving the cache. I'll update the branch since the master has had changes done recently and this will start the build again. Sometimes there are problems with the build that are unrelated to what you have done - I can understand how that can be confusing when you first see such things failing!

Copy link
Member

@woodsp-ibm woodsp-ibm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for contributing this fix to Aqua!

@manoelmarques manoelmarques merged commit 10ff7c1 into qiskit-community:master Oct 23, 2020
@manoelmarques manoelmarques added the stable backport potential The bug might be minimal and/or import enough to be port to stable label Nov 9, 2020
manoelmarques pushed a commit to manoelmarques/qiskit-aqua that referenced this pull request Nov 9, 2020
…ommunity#1362)

* Fixing QAOA initial_state problem

* fixing code style warnings

* Creating QAOA-initial_state-dont-mix-with-Hadamards bugfix test and a release note for the bugfix.

* Removing code that appeared in pull request due to error

* Fixing import math error

* Fixing code style issues.

Co-authored-by: Steve Wood <40241007+woodsp-ibm@users.noreply.github.com>
mtreinish pushed a commit to mtreinish/qiskit-core that referenced this pull request Nov 20, 2020
…ommunity/qiskit-aqua#1362)

* Fixing QAOA initial_state problem

* fixing code style warnings

* Creating QAOA-initial_state-dont-mix-with-Hadamards bugfix test and a release note for the bugfix.

* Removing code that appeared in pull request due to error

* Fixing import math error

* Fixing code style issues.

Co-authored-by: Steve Wood <40241007+woodsp-ibm@users.noreply.github.com>
manoelmarques pushed a commit to manoelmarques/qiskit-terra that referenced this pull request Dec 7, 2020
…ommunity/qiskit-aqua#1362)

* Fixing QAOA initial_state problem

* fixing code style warnings

* Creating QAOA-initial_state-dont-mix-with-Hadamards bugfix test and a release note for the bugfix.

* Removing code that appeared in pull request due to error

* Fixing import math error

* Fixing code style issues.

Co-authored-by: Steve Wood <40241007+woodsp-ibm@users.noreply.github.com>
manoelmarques pushed a commit to qiskit-community/qiskit-optimization that referenced this pull request Jan 14, 2021
…ommunity/qiskit-aqua#1362)

* Fixing QAOA initial_state problem

* fixing code style warnings

* Creating QAOA-initial_state-dont-mix-with-Hadamards bugfix test and a release note for the bugfix.

* Removing code that appeared in pull request due to error

* Fixing import math error

* Fixing code style issues.

Co-authored-by: Steve Wood <40241007+woodsp-ibm@users.noreply.github.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Changelog: Bugfix Include in the Fixed section of the changelog stable backport potential The bug might be minimal and/or import enough to be port to stable
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants